using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Lesson2 : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        AssetBundle ab = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/" + "model");
        //加载主包
        AssetBundle abMain = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/" + "PC");
        //加载主包中的固定文件
        AssetBundleManifest abManifset = abMain.LoadAsset<AssetBundleManifest>("AssetBundleManifest");
        //从固定文件中 得到依赖信息
        string[] strs = abManifset.GetAllDependencies("model");
        //得到依赖包的名字
        for (int i = 0; i < strs.Length; i++)
        {
            AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/" + strs[i]);
        }
        GameObject obj = ab.LoadAsset<GameObject>("Cube");
        Instantiate(obj);
    }
}
